package com.qys.livesMall.open.enums;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

@Getter
@AllArgsConstructor
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum PushMessageTypeEnum {
    NOTICE("公告","notice"),
    PUSH("推送","push"),
    ORDER_PUSH("订单推送","order_push"),
    SECKILL_PUSH("秒杀推送","seckill_push"),
    CONCERN("用户关注","concern"),
    NOTICE_ALL("全员通知","notice_all"),
    ;

    private String name;
    private String code;

    public static PushMessageTypeEnum getEnum(String code) {
        for (PushMessageTypeEnum typeEnum : PushMessageTypeEnum.values()) {
            if (Objects.equals(typeEnum.getCode(), code)) {
                return typeEnum;
            }
        }
        return null;
    }
}
